package com.jinduplan.planmanager.mvp.model

import com.cxz.kotlin.baselibs.mvp.BaseModel
import com.cxz.kotlin.baselibs.utils.GsonHelper
import com.jinduplan.planmanager.bean.*
import com.jinduplan.planmanager.http.MainRetrofit
import com.jinduplan.planmanager.mvp.contract.MainContract
import com.jinduplan.planmanager.mvp.contract.ProjectContract
import com.jinduplan.planmanager.mvp.contract.ProjectUploadContract
import com.jinduplan.planmanager.mvp.contract.ProjectUploadSignContract
import io.reactivex.rxjava3.core.Observable

/**
 * @author admin
 * @date 2018/11/20
 * @desc
 */
class ProjectUploadSignModel : BaseModel(), ProjectUploadSignContract.Model {
    override fun uploadPic(file: String): Observable<HttpResult<PicSignSuccess>> {
        return MainRetrofit.service.uploadSignaturePic(GsonHelper.uploadSinglePart(file,"signature"))
    }

    override fun sign(
        file: String,
        daily_construction_id: String,
        signature_date: String
    ): Observable<HttpResult<SignSuccess>> {
        return MainRetrofit.service.projectSign(GsonHelper.getRequestBoby(arrayListOf("daily_construction_id","signature_images","signature_date"),
            arrayListOf(daily_construction_id,file,signature_date)))
    }


}